
$(".select").click(function (event) {
    var target = event.target;
    var text = event.target.parentElement.firstElementChild.innerText ;

    ele = target.parentElement; //<dd>
if (ele.nodeName == 'DD') {
        //其他元素 删除样式
        var childrenEle = ele.parentElement.children;
        for (var i = 0; i < childrenEle.length; i++) {
            childrenEle[i].classList.remove("selected");
        }
        // 当前元素 添加样式
        ele.classList.add("selected");
        getResult();
    }
    /*
     var brand;
     var cpu;
     var ram;
     var sd;
     var price;
     if(text == "热门品牌："){
         var siblings = target.parentElement.children;
         for (var j = 0; j < siblings.length; j++) {
             siblings[j].className = '';
         }
         console.log("hello");
         target.className = "active";
         getResult();
     }
     else if(text == "CPU型号:"){
         var siblings = target.parentElement.children;
         for (var j = 0; j < siblings.length; j++) {
             siblings[j].className = '';
         }
         console.log("hello");
         target.className = "active";
         getResult();

     }
     else if(text == "运行内存:"){
         console.log("sdfwf")
         var siblings = target.parentElement.children;
         for (var j = 0; j < siblings.length; j++) {
             siblings[j].className = '';
         }
         console.log("hello");
         target.className = "active";
         getResult();

     }
     else if(text == "机身储存"){
         var siblings = target.parentElement.children;
         for (var j = 0; j < siblings.length; j++) {
             siblings[j].className = '';
         }
         console.log("hello");
         target.className = "active";
         getResult();

     }else if(text == "商品价格"){
         var siblings = target.parentElement.children;
         for (var j = 0; j < siblings.length; j++) {
             siblings[j].className = '';
         }
         console.log("hello");
         target.className = "active";
         getResult();

     }*/
    function getResult(){
        brand = $("#select1 .selected").text();
        ram = $("#select2 .selected").text();
        sd = $("#select3 .selected").text();
        price = $("#select4 .selected").text();
        console.log("brand:"+brand+"ram:"+ram+"sd:"+sd+"price:"+price)
        showProductList(brand,ram,sd,price,1);
    }

});